This tutorial shows you how to get the scrollbar width of an element in JavaScript.
CSS
This section shows you how to manipulate the element’s CSS using JavaScript DOM methods.
Check If an Element is Visible in the Viewport
In this tutorial, you’ll learn how to check if an element is visible in the viewport using JavaScript.
Replace a Class of an Element
This tutorial shows you how to replace a class with a new one using JavaScript DOM API.
Check If an Element contains a Class
This tutorial shows you how to check if an element contains a specific class using JavaScript DOM API.
Toggle a Class of an Element
This tutorial shows you how toggle a class of an element using the JavaScript DOM API.
Remove a Class from an Element
This tutorial shows you how to remove one or more classes from an element using JavaScript DOM API.
Add a Class to an Element
This tutorial shows you how to add one or more classes to an element in JavaScript
Get Width and Height of an Element
This tutorial shows you how to get the width and height of an element using JavaScript DOM API.
Get the Offset Position of an element Relative to Its Parent
To get the top/left coordinates of an element relative to its parent, you use the offsetLeft and offsetTop properties. The return values are in px:
Get the Width and Height of the Window
This tutorial shows you how to get the width and height of the window in JavaScript
Get and Set Scroll Position of the Document
This tutorial shows you how to get and set the scroll position of the document.
Get and Set Scroll Position of an Element
This tutorial shows you how to get and set the scroll position of an element using JavaScript DOM API.
Toggle an Element
This tutorial shows you how to toggle an element using plain JavaScript DOM API
Get Styles of an Element
Get the computed styles of an element by using the getComputedStyle() method.
How to Add Styles to an Element
In this tutorial, you’ll learn how to add styles to an element using JavaScript DOM methods.